package com.xinke.query.web.query.service.impl;

import com.xinke.query.model.entity.GaoSuInfo;
import com.xinke.query.model.enums.QueryStatus;
import com.xinke.query.web.query.service.GaoSuInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncQueryService {

    @Autowired
    @Lazy//延迟加载，防止
    private GaoSuInfoService gaoSuInfoService;


    @Async
    public void executeAsyncQuery(GaoSuInfo gaoSuInfo) {
        // 修改status为开启查询
        gaoSuInfoService.updateStatusById(gaoSuInfo.getId(), QueryStatus.PROCESSING);
        //开启查询,并存入文件系统
        gaoSuInfoService.openQuery(gaoSuInfo);

    }
}
